package com.example.frame.helper;

import com.example.frame.ConfigConstant;
import com.example.frame.util.PropertiesUtil;

import java.util.Properties;

/**
 * 属性文件助手类
 * @author chenjiebin
 */
public final class ConfigHelper {
    private static final Properties CONFIG = PropertiesUtil.loadProps(ConfigConstant.CONFIG_FILE);

    public static String getJdbcDriver() {
        return PropertiesUtil.getString(CONFIG, ConfigConstant.JDBC_DRIVER);
    }

    public static String getJdbcUrl() {
        return PropertiesUtil.getString(CONFIG, ConfigConstant.JDBC_URL);
    }

    public static String getJdbcUsername() {
        return PropertiesUtil.getString(CONFIG, ConfigConstant.JDBC_USERNAME);
    }

    public static String getJdbcPassword() {
        return PropertiesUtil.getString(CONFIG, ConfigConstant.JDBC_PASSWORD);
    }

    public static String getAppBasePackage() {
        return PropertiesUtil.getString(CONFIG, ConfigConstant.APP_BASE_PACKAGE, "com.example");
    }

    public static String getAppJspPath() {
        return PropertiesUtil.getString(CONFIG, ConfigConstant.APP_JSP_PATH, "/WEB-INF/view/");
    }

    public static String getAppAssetPath() {
        return PropertiesUtil.getString(CONFIG, ConfigConstant.APP_ASSET_PATH, "/asset/");
    }
}
